﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using QLPMT_BUS;
using QLPMT_DTO;

namespace my_project_qlpmt1
{
    public partial class DangNhap : Form
    {
        public DangNhap()
        {
            InitializeComponent();
        }
        private string _maphanquyen;

        public string Maphanquyen
        {
            get { return _maphanquyen; }
            set { _maphanquyen = value; }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {

                string user = txt_User.Text;
                string pass = txt_Pass.Text;
                new LogInBUS().config(txt_host.Text, txt_db.Text, txt_db_user.Text, txt_db_pass.Text);
                if (new LogInBUS().IsLogIn(user, pass) == true)
                {
                    LogIn dto = new LogInBUS().GetLogIn(user, pass);
                    Maphanquyen = dto.Maphanquyen;
                    Program.flag = true;
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Kiểm tra lại dữ liệu", "Thông báo");
                    txt_Pass.Text = "";
                    txt_User.Text = "";
                }
            }
            catch (Exception ex)
            {
                string t = ex.ToString();
            }
        }
    }
}
